function throttle(callback, wait) {
  let timeout;
  return function(...args) {
    if (!timeout) {
      timeout = setTimeout(() => {
        callback.apply(this, args);
        clearTimeout(timeout);
        timeout = null;
      }, wait)
    }
  }
}
